<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>个人订单</title>
  <link rel="stylesheet" type="text/css" href="css/index.css" />

</head>

<body bgcolor="#F0F8FF">

<div class="page">
  <div>
    <br>
  </div>
    <ul id="jsddm">
        <li>
            <a href="../index/index.jsp">首页</a>
        </li>
        <li onmouseover="showSubMenu(this)" onmouseout="hideSubMenu(this)">
            <a>商品分类</a>
            <ul>
                <li><a href="../index/showGoodsByType?typeid=101">服饰</a></li>
                 <li><a href="../index/showGoodsByType?typeid=102">食品</a></li>
                  <li><a href="../index/showGoodsByType?typeid=103">书籍</a></li>
                   <li><a href="../index/showGoodsByType?typeid=104">科技</a></li>
                    <li><a href="../index/showGoodsByType?typeid=105">日用</a></li>
            </ul>
        </li>
        <li onmouseover="showSubMenu(this)" onmouseout="hideSubMenu(this)">
            <a href="../user/showcar">我的购物车</a>
            
        </li>
        <li>
            <a href="../user/showorder">我的订单</a>
        </li>
        <li onmouseover="showSubMenu(this)" onmouseout="hideSubMenu(this)">
            <a >个人中心</a>
            <ul>
                <li><a href="../user/cusindex.jsp">个人中心</a></li>
                <li><a href="../user/logout">退出登录</a></li>
            </ul>
        </li>
        <li>
            <form action="../index/searchgoods" method="post">
                <input type="text" name="find_goods" placeholder="请输入商品名" style="width: 100px;height: 30px;border:1px solid #000000;">
                <input type="submit" name="submit" value="搜索" style="border:1px solid #000000;width: 40px;height: 25px">
            </form>
        </li>
    </ul>
        <script type="text/javascript" language="JavaScript">
    //显示子菜单


    function showSubMenu(li){
      var subMenu = li.getElementsByTagName("ul")[0];
      subMenu.style.display = "block";
    }

    //隐藏子菜单
    function hideSubMenu(li){
      var subMenu = li.getElementsByTagName("ul")[0];
      subMenu.style.display = "none";
    }

    function num_jia(){
      var i = event.target.id.slice(2);
      var x = document.getElementById("number_"+i);
      var y = document.getElementById("price_"+i).innerHTML;
      var z = document.getElementById("allprice_"+i);
      var a = Number(x.value);
      var b = Number(y);
      var data = document.getElementsByName("checkbox");
      a++;
      x.value=a;
      var c = Number(a*b).toFixed(2);
      z.innerHTML=c.toString();
      var s = data[i].value.split(";");
      // document.car.action= "";
      // document.car.submit();
      // return   true;
    }



    function num_jian(){
      var i = event.target.id.slice(2);
      var x = document.getElementById("number_"+i);
      var y = document.getElementById("price_"+i).innerHTML;
      var z = document.getElementById("allprice_"+i);
      var a = Number(x.value);
      var b = Number(y);
      var data = document.getElementsByName("checkbox");
      if(a>1){
        a--;
      }else{
        a=1;
      };
      x.value=a;
      var c = Number(a*b).toFixed(2);
      z.innerHTML=c.toString();
      var s = data[i].value.split(";");
      // document.car.action= "";
      // document.car.submit();
      // return   true;
    }

    function car_restore(){

        //--------------------------action--------------//
        document.car_function.action= "../goods/updateGoodsNum";

        document.car_function.submit();
        return   true;
      }
    
    function car_delete(){

      //--------------------------action--------------//
      alert("删除成功！");
      document.car_function.action= "../goods/delete";

      document.car_function.submit();
      return   true;
    }

    function car_submit(){

      //--------------------------action--------------//
      document.car_function.action= "../goods/buy";

      document.car_function.submit();
      return   true;
    }

    function getdata(){
      var data = document.getElementsByName("checkbox");
      var thisLength = data.length;
      var str = new Array(1000);
      for(var i = 0;i < thisLength;i++){
        if(data[i].checked == true){
          str[i] = data[i].value.split(";");
          alert(str[i][0]);
          alert(str[i][1]);
        }
      }
    }

  </script>
  <div class="content">
    <div class="zuo">

      <!---------------------------------------------------↓ 热销接口 ↓--------------------------------->
            <div class="fangshi">
                <h1>热销榜</h1>
                <br>&nbsp;
              <% int i=1; %>
                <c:forEach items="${goodsList_sales}" var="vo">
                	<a href="../goods/byPage?gid=${vo.gid}"> 
                	<img src="images/1.<% out.print(i++);%>.jpg">  ${vo.gname}
                	</a><br><br>&nbsp;
                </c:forEach>
            </div>
      <!---------------------------------------------------↑ 热销接口 ↑--------------------------------->

      <br>

      <!---------------------------------------------------↓ 热搜接口 ↓--------------------------------->
            <div class="fangshi">
                <h1>热搜榜</h1>
                <br>&nbsp;
              <% i=1; %>
                <c:forEach items="${goodsList_search}" var="vo">
                	<a href="../goods/byPage?gid=${vo.gid}"> 
                	<img src="images/1.<% out.print(i++);%>.jpg">  ${vo.gname}
                	</a><br><br>&nbsp;
                </c:forEach>
            </div>
      <!---------------------------------------------------↑ 热搜接口 ↑--------------------------------->

      <br>

      <!---------------------------------------------------↓ 猜你喜欢接口 ↓--------------------------------->
            <div class="fangshi">
                <h1>猜你喜欢</h1>
                <br>&nbsp;
                <% i=1; %>
                <c:forEach items="${goodsList_clike}" var="vo">
                	<a href="../goods/byPage?gid=${vo.gid}">
                	<img src="images/1.<% out.print(i++);%>.jpg">   ${vo.gname}
                	</a><br><br>&nbsp;
                </c:forEach>
                <br><br>
            </div>
      <!---------------------------------------------------↑ 猜你喜欢接口 ↑--------------------------------->

      <br>
    </div>
    <div class="you">
      <div class="clearit"></div>

      <!---------------------------------------------------↓ 首页随机接口 ↓--------------------------------->
      <!-------------for循环生成div i<=(list.size()+1)/2 ---------------->


      <form action="" method="post">
        <br>
        &nbsp;&nbsp;
        <p style="font-family:楷体; font-size: 48px; color: black" >我的订单</p><br /><br />
        <table style="border:1px solid #000; position: relative; left: 10px">
          <thead>
          <tr>
            <th >&nbsp;&nbsp;&nbsp;订单时间&nbsp;&nbsp;&nbsp;</th>
            <th>&nbsp;&nbsp;&nbsp;商品图片&nbsp;&nbsp;&nbsp;</th>
            <th>&nbsp;&nbsp;&nbsp;商品名称&nbsp;&nbsp;&nbsp;</th>
            <th>&nbsp;&nbsp;&nbsp;单价&nbsp;&nbsp;&nbsp;</th>
            <th>&nbsp;&nbsp;&nbsp;数量&nbsp;&nbsp;&nbsp;</th>
            <th>&nbsp;&nbsp;&nbsp;总金额&nbsp;&nbsp;&nbsp;</th>
          </tr>
          </thead>

          <tbody>

       <%i=0;%>

      	<c:forEach items="${orderList}" var="vo">
      		<tr>
            	<td>${vo.buy_date}</td>
            	<td><img src="../img/${vo.picture}" width="50" height="50"></td>
            	<td>${vo.gname}</td>
            	<td>${vo.gprice}</td>
            	<td>${vo.good_num}</td>
            	<td>${vo.gprice*vo.good_num}</td>
          </tr>
      	</c:forEach>  
          </tbody>
        </table>
        <br>
		</form>
      <!---------------------------------------------------↑ 首页随机商品接口 ↑--------------------------------->



    </div>
    <br>
    <div class="clearit"></div>

  </div>
</div>
<div>
  <p class="banquan">&nbsp;</p>
  <p class="banquan">版权所有：刘艺杰、安森泰、张恒超、卢晓丹、贾文婷 2021-现在</p>
  <a href="mailto:2629145453@qq.com"><p class="banquan">联系我们</p></a>
  <p class="banquan">&nbsp;</p>
</div>

</body>
</html>
